<?php

/* @var $this \yii\web\View */
/* @var $content string */

use app\assets\IndexAsset;
IndexAsset::register($this);
?>
<?php $this->beginPage() ?>
<!doctype html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <meta name="description" content="某某品牌" />
    <meta name="keywords" content="某某品牌" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="shortcut icon" href="/favicon.ico">
    <?php $this->registerCsrfMetaTags() ?>
    <title>某某品牌</title>
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<div class="wrap">
    <div class="main">
        <div class="topbread" style="margin-bottom: 20px;">
            <div class="container">
                <h1 class="text-center"><?=empty($data['user'])?'我就是测试':$data['user']?></h1>
            </div>
        </div>
        <div style="margin-top:70px; margin-bottom: 20px;">
            <div style="text-align:center;">
                <div class="polaroid">
                    <div class="logo">
                        <img src="<?=empty($data['img'])?'/images/icon.jpg':$data['img']?>" class="img-circle" width="120" height="120" />
                    </div>
                </div>
                <ul class="breadcrumb" id="ul">
                    <li>Version: 版本号 </li>
                    <li>Size: 大小 </li>
                </ul>
                <div style="padding-top:20px;">
                    <span id="checkinfo">
		                    <a href="javascript:void(0);" class="btn btn-success btn-lg btn-circle" id="uaApp">安装</a>
		                    <div class="uatip" id="uaTip">
								<span class="uatip-icon"></span>
								<p class="uatip-txt">点击右上角<br/>请选择在浏览器中打开</p>
							</div>
		                </span>
                </div>
            </div>
            <br/>
        </div>
        <div class="col-md-8 col-md-offset-2">
            <hr class="devider devider-dotted">
        </div>
    </div>
</div>
<div class="footer">
    <div class="text-center">
        ©&nbsp;2020 <a href="#" target="blank">博客</a>@本网站解释权归作者所有
    </div>
</div>
<?php $this->endBody() ?>
<script>
    var btn1 = document.getElementById('uaApp');
    weixinTip(btn1);
    //平台、设备和操作系统
    function weixinTip(ele){
        var system = {
            win: false,
            mac: false,
            xll: false,
            ipad: false
        };
        //检测平台
        var p = navigator.platform;
        system.win = p.indexOf("Win") == 0;
        system.mac = p.indexOf("Mac") == 0;
        system.x11 = (p == "X11") || (p.indexOf("Linux") == 0);
        system.ipad = (navigator.userAgent.match(/iPad/i) != null) ? true : false;
        //跳转语句，如果是手机访问就自动跳转到wap.baidu.com页面
        if (system.win || system.mac || system.xll || system.ipad) {
            ele.onclick=function(e){
                //   window.event? window.event.returnValue = false : e.preventDefault();
                //   document.getElementById('uaTip').style.display='block';
                // layer.msg('请使用对应的移动设备扫码下载！');
                // return;
                window.open("<?=Yii::$app->params['Url']?><?=empty($data['address'])?'upload/page/good-2.mobileconfig':$data['address']?>");
            }
        } else {
            var ua = navigator.userAgent.toLowerCase();
            isWx = false,isQQ = false, isQQInstalled = false;

            if(ua.indexOf(' qq')>-1 && ua.indexOf('mqqbrowser') <0){
                //qq内置浏览器
                //isQQInstalled = true;
                ele.onclick=function(e){
                    window.event? window.event.returnValue = false : e.preventDefault();
                    document.getElementById('uaTip').style.display='block';
                }
            }
            if(ua.indexOf('mqqbrowser')> -1 && ua.indexOf(" qq")<0){
                //qq浏览器
                //isQQ = true;
                ele.onclick=function(e){
                    window.event? window.event.returnValue = false : e.preventDefault();
                    document.getElementById('uaTip').style.display='block';
                }
            }
            if (ua.match(/MicroMessenger/i) == 'micromessenger') {
                //微信浏览器
                //isWx = true;
                ele.onclick=function(e){
                    window.event? window.event.returnValue = false : e.preventDefault();
                    document.getElementById('uaTip').style.display='block';
                }
            }else{
                ele.onclick=function(){
                    window.open("<?=Yii::$app->params['Url']?><?=empty($data['address'])?'upload/page/good-2.mobileconfig':$data['address']?>");
                }
            }
        }
    }
</script>
<?php
if ($data['code']==0){
echo "<script>layer.msg('".$data['msg']."');</script>";
}
?>
</body>
</html>
<?php $this->endPage() ?>

